<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
include_once("../../config.inc.php");
$_LangPath = "bettypeparam";	//語言檔參數，務必放在最前面
include_once(__Admin_Path."/logincheck.php");
include_once(__Language_Path."/selectlanguage_admin.php");
include_once(__Modules_Path."/LogRecord.lib.php");

$arrPower = CheckUsePower("BetTypeParam");
if($arrPower === false)ErrMsgOutputHTML("Error", "", 1);

$intLType = (int)$_data["LType"];

$_KBetTypeParam = $_data["KBetTypeParam"];
while (list($k1, $v1) = each($_KBetTypeParam)) {
	$arrSet = array();
	while (list($k2, $v2) = each($v1)) {
		$arrSet[] = $k2." = '".$v2."'";
	}
	$arrLog[] = "ID = ".(int)$k1.", ".join(", ", $arrSet);
	$strSQL = "update `bet_BetType` set ".join(", ", $arrSet)." where ID = ".(int)$k1." and LType = ".$intLType;
	if(!PMA_mysql_query($strSQL, $_ConnMaster)){
		$GLOBALS["errormessage"] = "Update BetType Data Error!!";
		$GLOBALS["errorhidden"] = "\nErr: ".PMA_mysql_error($_ConnMaster).",\nSQL: ".$strSQL.",\nLine: ".__LINE__.",\nPage: ".__FILE__;
		ErrMsgOutputHTML("Error", "", 1);
	}
}

if ($fp = fopen(__Common_Path."/BetTypeParam_".$intLType.".inc.php","w")) {
	fputs($fp,"<?php\n\$_KBetTypeParam=unserialize(\"".addslashes(serialize($_KBetTypeParam))."\");\n?>");
	fclose($fp);
}else{
	$GLOBALS["errormessage"] = "Open BetTypeParam File Error!!";
	$GLOBALS["errorhidden"] = "\nLine: ".__LINE__.",\nPage: ".__FILE__;
	ErrMsgOutputHTML("Error", "", 1);
}
AddData_Log($_SESSION["Admin_Info"] -> ID, "修改 BetType Param 資料", join("\n", $arrLog));
$GLOBALS["errormessage"] = "Update BetType Param Success!!";
ErrMsgOutputHTML("Error", "", 1);
?>
